* Robustness test including ideology

xtmelogit redpref1 c.incomedif c.incomedif#c.forpop age i.gender education i.religion i.union i.euroesec lrscale ///
forpop socgdp i.year if brncntr==1 || country:
xtmelogit, or

* Predicted probabilities for Table 

margins, at(incomedif=(-2.5 2.9) forpop=(5.3 14.7)) predict(mu fixedonly)

* Robustness test including fear of crime

xtmelogit redpref1 c.incomedif c.incomedif#c.forpop age i.gender education i.religion i.union i.euroesec fear ///
forpop socgdp i.year if brncntr==1 || country:
xtmelogit, or

* Predicted probabilities for Table 

margins, at(incomedif=(-2.5 2.9) forpop=(5.3 14.7)) predict(mu fixedonly)

* Inequality

xtmelogit redpref1 c.incomedif c.incomedif#c.forpop age i.gender education i.religion i.union i.euroesec gini ///
forpop socgdp i.year if brncntr==1 || country:
xtmelogit, or

* Predicted probabilities for Table 

margins, at(incomedif=(-2.5 2.9) forpop=(5.3 14.7)) predict(mu fixedonly)

* Robustness test including urbanization

xtmelogit redpref1 c.incomedif c.incomedif#c.forpop age i.gender education i.religion i.union i.euroesec domicil ///
forpop socgdp i.year if brncntr==1 || country:
xtmelogit, or

* Predicted probabilities for Table 

margins, at(incomedif=(-2.5 2.9) forpop=(5.3 14.7)) predict(mu fixedonly)

* Robustness test including transfer classes

xtmelogit redpref1 c.incomedif c.incomedif#c.forpop age i.gender education i.religion i.union i.euroesec transfer ///
forpop socgdp i.year if brncntr==1 || country:
xtmelogit, or

* Predicted probabilities for Table 

margins, at(incomedif=(-2.5 2.9) forpop=(5.3 14.7)) predict(mu fixedonly)

* Robustness test including domestic unemployment

xtmelogit redpref1 c.incomedif c.incomedif#c.forpop age i.gender education i.religion i.union i.euroesec natunemp ///
forpop socgdp i.year if brncntr==1 || country:
xtmelogit, or

* Predicted probabilities for Table 

margins, at(incomedif=(-2.5 2.9) forpop=(5.3 14.7)) predict(mu fixedonly)

* Great Recession analysis

xtmelogit redpref1 c.incomedif c.incomedif#c.forpop age i.gender education i.religion i.union i.euroesec ///
forpop socgdp i.year if (brncntr==1 & year>2007) || country:
xtmelogit, or

* Predicted probabilities for Table 

margins, at(incomedif=(-2.5 2.9) forpop=(5.3 14.7)) predict(mu fixedonly)


* Robustness test including Rehm's occupational unemployment rates

xtmelogit redpref1 c.incomedif c.incomedif#c.forpop age i.gender education i.religion i.union i.euroesec our ///
forpop socgdp i.year if brncntr==1 || country:
xtmelogit, or

* Predicted probabilities for Table 

margins, at(incomedif=(-2.5 2.9) forpop=(5.3 14.7)) predict(mu fixedonly)

* Robustness test including Rehm's occupational unemployment rates and interaction with heterogeneity (for footnote)

xtmelogit redpref1 c.incomedif c.incomedif#c.forpop age i.gender education i.religion i.union i.euroesec our ///
c.our#c.forpop forpop socgdp i.year if brncntr==1 || country:
xtmelogit, or

* Predicted probabilities for Table 

margins, at(incomedif=(-2.5 2.9) forpop=(5.3 14.7)) predict(mu fixedonly)

* Robustness test including altruism as personality trait

xtmelogit redpref1 c.incomedif c.incomedif#c.forpop age i.gender education i.religion i.union i.euroesec ipeqopt ///
forpop socgdp i.year if brncntr==1 || country:
xtmelogit, or

* Predicted probabilities for Table 

margins, at(incomedif=(-2.5 2.9) forpop=(5.3 14.7)) predict(mu fixedonly)

* Robustness test  with foreign-born unemployed

xtmelogit redpref1 c.incomedif c.incomedif#c.forunpop age i.gender education i.religion i.union i.euroesec ///
forunpop socgdp i.year if (brncntr==1) || country:

* Predicted probabilities for Table 

margins, at(incomedif=(-2.5 2.9) forunpop=(.44 1.78)) predict(mu fixedonly)

* Robustness test  with ethnic minority poor

xtmelogit redpref1 c.incomedif c.incomedif#c.ethperpoor age i.gender education i.religion i.union i.euroesec ///
ethperpoor socgdp i.year if (brncntr==1) || country:

* Predicted probabilities for Table 

margins, at(incomedif=(-2.5 2.9) ethperpoor=(1.8 6.7)) predict(mu fixedonly)


* Robustness test  with perception of immigration


xtmelogit redpref1 c.incomedif c.incomedif#c.imwbcnt age i.gender education i.religion i.union i.euroesec ///
c.imwbcnt socgdp i.year if (brncntr==1) || country:

* Predicted probabilities for Table 

margins, at(incomedif=(-2.5 2.9) imwbcnt=(2 8)) predict(mu fixedonly)


* Drop top income category in 2002-2006

preserve

drop if hinctnt==12

* Drop also top category after 2006

drop if hinctnta==10

* Create alternative income mean per country and year

sort country essround
by country essround: egen mpppincome2=mean(income_ppp2010)


* Create alternative difference between individual income and country specific mean income
* And divide by 1000 so that the unit is thousands of 2010 PPP-corrected dollars


gen incomedif2=(income_ppp2010-mpppincome2)/10000

xtmelogit redpref1 c.incomedif2 c.incomedif2#c.forpop age i.gender education i.religion i.union i.euroesec ///
forpop socgdp i.year if brncntr==1 || country:
xtmelogit, or

* Predicted probabilities for Table 

margins, at(incomedif2=(-2.5 2.9) forpop=(5.3 14.7)) predict(mu fixedonly)

restore

* Relative income as % of mean

* Create alternative income mean per country and year

sort country essround
by country essround: egen mnatincome=mean(natincome2010)


* Create alternative difference between individual income and mean income
* as % of country-round specific mean income


gen incomedif3=((natincome2010-mnatincome)/mnatincome)*100

xtmelogit redpref1 c.incomedif3 c.incomedif3#c.forpop age i.gender education i.religion i.union i.euroesec ///
forpop socgdp i.year if brncntr==1 || country:
xtmelogit, or

* Predicted probabilities for Table 

margins, at(incomedif3=(-70 84) forpop=(5.3 14.7)) predict(mu fixedonly)


* Robustness test with only strongly agree

xtmelogit redpref2 c.incomedif c.incomedif#c.forpop age i.gender education i.religion i.union i.euroesec ///
forpop socgdp i.year if brncntr==1 || country:
xtmelogit, or

* Predicted probabilities for Table 

margins, at(incomedif=(-2.5 2.9) forpop=(5.3 14.7)) predict(mu fixedonly)


* Robustness test with 3 levels (individual, year, country)

xtmelogit redpref1 c.incomedif c.incomedif#c.forpop age i.gender education i.religion i.union i.euroesec ///
forpop socgdp if brncntr==1 || country: || year:
xtmelogit, or

* Predicted probabilities for Table 

margins, at(incomedif=(-2.5 2.9) forpop=(5.3 14.7)) predict(mu fixedonly)

* Robustness test with imputed data

mi set mlong

mi register imputed incomedif education religion union euroesec forpop

mi xtset, clear 

mi impute mvn incomedif education religion union euroesec forpop  = age gender socgdp year country lrscale ///
fear domicil health happy hhmmb hincfel, add(5) rseed (53421) force

* Predicted probabilities for Table 
* Following procedure suggested here: http://www.ats.ucla.edu/stat/stata/faq/ologit_mi_marginsplot.htm

mi estimate: xtmelogit redpref1 c.incomedif c.incomedif#c.forpop age gender education religion union euroesec  ///
c.forpop c.socgdp i.year if brncntr==1 || country:  

program emargins, eclass properties(mi)
  version 12
  args outcome
  xtmelogit redpref1 c.incomedif c.incomedif#c.forpop age i.gender education religion union euroesec ///
forpop socgdp i.year if brncntr==1 || country:
margins, at(incomedif=(-2.5 2.9) forpop=(5.3 14.7)) post predict(mu fixedonly)
end

mi estimate, cmdok: emargins 1      

clear

* Reopen main data file

use rueda



